"""
============================
@auther:多测师-黄sir
@time:2021/9/8:9:50
@email:hw18983616870@163.com
@website:www.duoceshi.cn
============================
"""
'''封装读取ini配置文件内容的方法'''
# configparser模块是专门用来读取ini文件的
from configparser import ConfigParser
from config.Config import *
class Read_Data_Ini(ConfigParser):
    def __init__(self,filename):
        #继承Configparser类的构造函数
        # ConfigParser.__init__(self)
        super(ConfigParser, self).__init__()
        self.read(filename)

    def read_data_ini(self,section,option):
        return self.get(section=section,option=option)

ini_path = os.path.join(data_path,'data.ini')
# print(ini_path)
r = Read_Data_Ini(ini_path)
url = r.read_data_ini(section='discuz_test',option='url')
# print(url)
username = r.read_data_ini(section='discuz_test',option='username')
pwd = r.read_data_ini(section='discuz_test',option='pwd')

url1 = r.read_data_ini(section='discuz1_test',option='url1')
username1 = r.read_data_ini(section='discuz1_test',option='username1')
pwd1 = r.read_data_ini(section='discuz1_test',option='pwd1')

